Skip to content

Vignette: tmax/tmin section + map clipping + critical-look interpretation fixes (#39)#41

Merged
NewGraphEnvironment merged 3 commits into
mainfrom
39-vignette-tmax-tmin-maps
Apr 15, 2026
Merged

Vignette: tmax/tmin section + map clipping + critical-look interpretation fixes (#39)#41
NewGraphEnvironment merged 3 commits into
mainfrom
39-vignette-tmax-tmin-maps

Conversation

@NewGraphEnvironment
Copy link
Copy Markdown
Owner

Summary

  • Tighten existing maps by clipping context layers (towns, lakes, rivers, streams, highways) and masking departure rasters to the AOI watershed group polygon. No more features extending past the basin boundary.
  • Add a new "Daytime Highs and Overnight Lows" section using the now-available tmax/tmin variables. Honest narrative for KOTL: textbook day-night asymmetry does NOT show here (diurnal range is flat); the dominant signal is summer daytime maximum (+2.8 °C since 1951) — the temperature envelope driving salmonid thermal stress in tributaries.
  • Critical re-read of the existing interpretation: precipitation trend was incorrectly described as "weak" (it's a significant -10.7% over 75 years), and soil drying was attributed to "stable precipitation" (in fact precipitation is down AND ET is up — both contribute). Fixed.
  • Demonstrate cd_compare(method = "pct_change") for variables where percent change is more interpretable than absolute (prcp, soil_moisture).
  • kableExtra scroll boxes on the long tables (catalog, baseline, compare, all-trends).
  • Drop bookdown section numbering — section titles now read as prose.
  • README quick-start was referencing nonexistent files; fixed and replaced "vignette coming soon" with the live link.

Test plan

  • Vignette renders cleanly via rmarkdown::render() (HTML 2.7 MB)
  • Spot-checked all maps in browser — context layers stay inside watershed boundary, departure rasters mask outside the AOI
  • Trend numbers in narrative cross-checked against the actual cd_trend() output for KOTL (slopes, p-values, % changes match)
  • cd_compare(method = "pct_change") returns expected percent values
  • All four scroll-boxed tables behave correctly
  • No section numbers in rendered headers
  • Full devtools::check() (will run on PR CI)

What is NOT in this PR

  • No changes to R/ function signatures
  • No changes to producer pipeline
  • No restructuring of existing tmean / soil_moisture content (still the backbone of the vignette)
  • No new content for frost days / heat stress / vpd × tmax — explicitly out of scope, called out in the original issue

Ecological framing notes

  • "Salmonid" not "salmon" throughout — anadromous salmon runs to Kootenay Lake are blocked by lower-Columbia dams. The relevant species for thermal stress are resident salmonids (kokanee, bull trout, Gerrard rainbow) and First Nations reintroduction efforts.

Fixes #39
Relates to #36
Relates to NewGraphEnvironment/sred-2025-2026#23

🤖 Generated with Claude Code

NewGraphEnvironment and others added 3 commits April 14, 2026 16:37
Per planning-archive skill convention:
- Moved completed #36 PWF from planning/active/ to
  planning/archive/2026-04-issue-36-edh-migration/ with a README
  summarising outcome and key findings for future sessions.
- Replaced planning/active/ with fresh task_plan.md, findings.md,
  progress.md for #39 (vignette tmax/tmin + map clipping).

The pre-existing planning/completed/ dir holds 21 legacy files from
earlier issues; migrating those to the archive/ convention is a
separate cleanup, not in scope here.

Relates to #39

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Two improvements in one pass:

1. Tightened maps. All context layers (towns, lakes, rivers, streams,
   highways) are now clipped to the AOI watershed group via st_intersection
   in the load-context chunk; the two spatial-departure rasters are masked
   to the AOI so cells outside the watershed render transparent. Replaces
   the previous bbox-based view that showed features extending past the
   WSG boundary.

2. New "Day-Night Asymmetry" section between Seasonal Patterns and
   Precipitation/Soil Moisture. Three figures showcase the tmax/tmin
   data now on STAC:
   - tmax annual anomaly time series
   - tmin annual anomaly time series
   - diurnal range (tmax - tmin) trend

   Ecological framing covers ET intensification from warmer nights,
   weakened cold-air pooling and pest-overwintering implications, and
   the stream thermal regime consequence for salmon-bearing watersheds.

Code-checked. Two minor doc-quality fixes from review applied:
- Per-layer st_agr("constant") instead of broad suppressWarnings()
  so genuine geometry warnings still surface
- Added fig.cap to plot-tmax and plot-tmin so they're cross-referenceable

Vignette renders cleanly; HTML size 2.69 MB.

Relates to #39

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Iteration after looking at the actual KOTL trend data:

- Narrative now matches the data. The textbook day-night asymmetry
  does not show at this watershed (diurnal range trend is -0.06 C
  over 75 years, well within noise). Pivoted the section to focus
  on the strongest signal that DOES show: summer daytime maximum
  has warmed 2.8 C since 1951.
- Interpretation rewritten. Previous text claimed precipitation
  trends are weak — the data show -10.7% over 75 years at
  p = 0.015, a real significant decline. Soils are drying because
  precipitation is down AND warmer temperatures drive higher
  evapotranspiration; both compound.
- Salmonid not salmon, with explicit note that anadromous runs to
  Kootenay Lake are blocked by lower-Columbia dams. Resident
  salmonids and First Nations reintroduction efforts are the
  ecological hook for summer thermal stress.

Other improvements:
- cd_compare now demonstrated with method="pct_change" for
  precipitation and soil moisture, alongside the absolute mean_diff.
- kableExtra scroll_box wraps the long tables (catalog, baseline,
  compare, all-trends) so they don't dominate vertical layout.
  Added kableExtra to DESCRIPTION Suggests.
- Bookdown section numbering disabled per request — section titles
  read as prose, not numbered chapters.
- README quick-start fixed: was referencing example_aoi.gpkg
  (does not exist) and example_catalog.json arg (no longer needed —
  cd_catalog() defaults to the live S3 catalog). Replaced "Vignette
  coming soon" link with the live pkgdown article.

Relates to #39
Relates to NewGraphEnvironment/sred#23

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@NewGraphEnvironment NewGraphEnvironment merged commit ffbb736 into main Apr 15, 2026
1 check passed
@NewGraphEnvironment NewGraphEnvironment deleted the 39-vignette-tmax-tmin-maps branch April 15, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vignette: add tmax/tmin with ecological framing + clip maps to watershed group

1 participant